package com.mozai.shopping.controller;

import com.mozai.shopping.model.base.BaseResponse;
import com.mozai.shopping.model.http.UserReq;
import com.mozai.shopping.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

@RestController
@RequestMapping (value = "/user")
@Api(tags = "登录接口")
public class UserController {

    @Autowired
    UserService userService;
    @ApiOperation(value = "用户登录",notes = "登录接口")
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public BaseResponse login(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse ,
                              @Valid @RequestBody UserReq userReq){
        return userService.login(httpServletRequest,httpServletResponse,userReq);
    }
}
